LScripts will use this file (albiet, indirectly) to house variable values
that are saved using the store() and
recall() functions. Along
with these script-owned values, LScript maintains two of its own variables.
The first, ScriptPath, is maintained by LScript to help it remember
where you keep your scripts. The second, DefaultLib, is discussed next.
Specifying Default Libraries
By employing the library command
directly in your LScript, you can import pre-built or commonly-used LScript
user-defined procedures.
However, instead of having to duplicate often-used library directives in each script, LScript allows you to specify default LScript libraries to be loaded each time a script is executed. This is accomplished by adding a new entry in the LScript configuration file (LSCRIPT.CFG) called DefaultLib.
The contents of this variable are arranged much like an MS-DOS PATH variable. Each library entry you add to this variable needs to be separated from others using a semi-colon (;) character. Library file names can contain a path specification--and should if LScript cannot locate the file at execution-time. The DefaultLib entry needs to be added to the [LSCRIPT] area of the configuration file.
[LSCRIPT] ScriptPath=C:\LW\LSCRIPT DefaultLib=C:\LW\LSLIB\LIB1.LS;C:\LW\LSLIB\LIB2.LS ...
If the autoerror pragma has been omitted from your script, run-time errors are defined as those that occur within the script itself (such as attempts to access uninitialized variables). However, errors that occur in Modeler-specific commands and functions during run-time will also qualify for this automatic cleanup if autoerror is selected.
The batch.ls example script contains an illustration of the use of this command. The following code snippet is taken from that script:
ONERROR { commandFile.close(); replyFile.close(); batchFile.close(); filedelete(tmp,"\\snii.job"); filedelete(tmp,"\\snii.rpl"); terminate(snID); // shut down ScreamerNet }Because the ONERROR() command does not accept parameters, variables that you need to process at script shutdown need to be declared with global scope (outside any user-defined procedure or main()).
var files[10]; // max of ten names ... files = matchfiles("\\","*.bat"); // get names of batch files in root directory
// change the "working" directory to one required by ScreamerNet var snDir; var oldDir; if((snDir = getenv("LW3D")) == nil) // is it (properly) in the environment? oldDir = chdir("\\windows\\apps\\newtek\\programs"); else oldDir = chdir(snDir); snID = spawn("lwsn -2 ", getenv("TMP"),"\\snii.job ", getenv("TMP"),"\\snii.rpl"); chdir(olddir); // move back to our start-up directoryIf the chdir() function fails to set the working directory to the one specified, a value of nil will be returned.
As with mkdir, this command accepts a string specifying the directory
(with optional path) to be removed, and returns a result code.
cross3d
cross3d() is used to calculate the cross product of two 3D vectors.
dot3d
dot3d() is used to calculate the dot product of two 3D vectors.
cross2d
cross2d() is used to calculate the cross product of two floating-point values.
dot2d
dot2d() is used to calculate the dot product of two floating-point values.
Table of Contents
Index